package com.crm.config;

import com.aliyun.oss.OSS;
import com.aliyun.oss.OSSClientBuilder;
import com.crm.properties.AliOssConfigProperties;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class OSSClientConfig {

    @Autowired
    private AliOssConfigProperties aliOssConfig;

    @Bean
    public OSS ossClient() {
        return new OSSClientBuilder().build(
            aliOssConfig.getEndpoint(),
            aliOssConfig.getAccessKeyId(),
            aliOssConfig.getAccessKeySecret()
        );
    }
}
